package com.jack90john;

/**
 * Description:
 * Designer: jack
 * Date: 2018/4/4
 * Version: 1.0.0
 */
public class Playbook {
    private Command[] onCommands;
    private Command[] offCommands;

    public Playbook() {
        this.onCommands = new Command[11];
        this.offCommands = new Command[11];

        Command noCommand = new NoCommand();

        for (int i = 0; i < 7; i++) {
            onCommands[i] = noCommand;
            offCommands[i] = noCommand;
        }

    }

    public void setCommands(int slot, Command onCommand, Command offCommand) {
        this.onCommands[slot] = onCommand;
        this.offCommands[slot] = offCommand;
    }

    public void onButtonWasPushed(int slot) {
        this.onCommands[slot].executed();
    }

    public void offButtonWasPushed(int slot) {
        this.offCommands[slot].executed();
    }
}
